package com.bnyy.message.enums;

/**
 * Author : 关炳鹏
 * Description :
 * Date : 2022/11/11
 **/
public enum GroupChatIdentity {

    MEMBER("群员",0), // 群员
    GROUP_LEADER("群主",1, 3, 4), // 群主
    MANAGER("群管理员",2); // 群管理员

    private String identity;
    private int[] authority;

    GroupChatIdentity(String identity, int... authority) {
        this.identity = identity;
        this.authority = authority;
    }

    public int[] getAuthority() {
        return authority;
    }

    public static GroupChatIdentity getGroupAuthority(int authority) {
        switch (authority) {
            case 1:
            case 3: // 设备使用人
            case 4: // 监护人
                return GROUP_LEADER;
            case 2:
                return MANAGER;
        }
        return MEMBER;
    }
}
